package com.locatme.fragmentmaps;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
import com.google.android.gms.maps.model.Marker;
import com.main.locatme.R;

public class MapsCustomInfoWindow implements InfoWindowAdapter{
    private final View myContentsView;
    private String txtpseudo;
    private String txtlangue;
    private String txtdescr;

    MapsCustomInfoWindow(LayoutInflater inflater) {
        myContentsView = inflater.inflate(R.layout.marker_infowindow, null);
    }

    @Override
    public View getInfoContents(Marker marker) {
        render(marker, myContentsView);

        TextView pseudo = (TextView) myContentsView.findViewById(R.id.pseudo);
        TextView descr = (TextView) myContentsView.findViewById(R.id.descr);

        pseudo.setText(marker.getTitle());
        descr.setText(marker.getSnippet());
        return myContentsView;
    }

    @Override
    public View getInfoWindow(Marker marker) {
        return null;
    }

    private void render(Marker marker, View view) {
        TextView pseudo = (TextView) myContentsView.findViewById(R.id.pseudo);
        TextView langue = (TextView) myContentsView.findViewById(R.id.langue);
        TextView descr = (TextView) myContentsView.findViewById(R.id.descr);
        pseudo.setText(getTxtpseudo());
        langue.setText(getTxtpseudo());
        descr.setText(getTxtpseudo());
    }

    public String getTxtdescr() {
        return txtdescr;
    }

    public void setTxtdescr(String txtdescr) {
        this.txtdescr = txtdescr;
    }

    public String getTxtlangue() {
        return txtlangue;
    }

    public void setTxtlangue(String txtlangue) {
        this.txtlangue = txtlangue;
    }

    public String getTxtpseudo() {
        return txtpseudo;
    }

    public void setTxtpseudo(String txtpseudo) {
        this.txtpseudo = txtpseudo;
    }
}
